<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function fn(str){
            var dxflag = false;
            var xxflag = false;
            var xhxflag = false;
            var myflag = false;
            for(i = 0;i<str.length;i++){
                var result = str.charCodeAt(i)
                if(result>=65 && result<=90){
                    dxflag = true
                }
                else if(result>=97 && result<=122){
                    xxflag = true
                }
                else if(result == 95){
                    xhxflag = true

                }
                else if(result == 36){
                    myflag = true
                }
            }
            return ['该字符串有大写字母吗？'+dxflag,'该字符串有小写字母吗？'+xxflag,'该字符串有_符号吗?'+xhxflag,'该字符串有$符号吗？'+myflag]
        }
        console.log(fn('DJfjfiv_fN'))

    </script>
        <script>
            function fn(str){
                var dxnum = 0;
                var xxnum = 0;
                var xhxnum = 0;
                var mynum = 0;
                for(i = 0;i<str.length;i++){
                    var result = str.charCodeAt(i)
                    if(result>=65 && result<=90){
                        dxnum++
                    }
                    else if(result>=97 && result<=122){
                        xxnum++
                    }
                    else if(result == 95){
                        xhxnum++
                    }
                    else if(result == 36){
                        mynum++
                    }
                }
                return ['有大写字母'+dxnum+'个','有小写字母'+xxnum+'个','有下划线'+xhxnum+'个','有美元符号'+mynum+'个']
            }
            var pass = fn('Adh$Uddko$PL')
            console.log(pass)
    
        </script>
</body>
</html>